// 登录成功 显示用户信息
let useEle=document.querySelector(".tbif");
let tbrit_a1Ele=document.querySelector(".tbrit_a1");//注册
let tbrit_a2Ele=document.querySelector(".tbrit_a2");//登录
function checkUser(){
	 let user = localStorage.getItem("username");
	 console.log(user)
	 if (user == null || user == "") {
		 tbrit_a2Ele.innerHTML="登录";
	 }else{
		  tbrit_a2Ele.innerHTML= "用户名:" + user;
		  tbrit_a2Ele.onclick=function(e){
			   e.preventDefault();//阻止默认事件
		  }
		  tbrit_a1Ele.innerHTML="退出";
		   tbrit_a1Ele.onclick=function(e){
			   exit();
			   e.preventDefault();
			   window.location.href = "index.html";
		   }
	 }
}
checkUser();
//点击退出销毁缓存
function exit() {
    localStorage.clear();
    checkUser();
}


